package cn.hp.service.impl;

import cn.hp.entity.Department;
import cn.hp.mapper.DepartmentMapper;
import cn.hp.service.DepartmentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Resource
    private DepartmentMapper departmentMapper;
    @Override
    public List<Department> selectDepartment(Department department) {
        return departmentMapper.selectDepartment(department);
    }
    @Override
    public PageInfo<Department> selectDepartment(Department department, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<Department> list = departmentMapper.selectDepartment(department);
        return new PageInfo<>(list);
    }
    @Override
    public int insertDepartment(Department department) {
        return departmentMapper.insertDepartment(department);
    }
    @Override
    public int updateDepartment(Department department) {
        return departmentMapper.updateDepartment(department);
    }
    @Override
    public int deleteDepartmentById(Integer id) {
        return departmentMapper.deleteDepartmentById(id);
    }


}
